mini.parse();

function compareDate(dateOne, dateTwo) {
	if (dateOne > dateTwo) {
		return false;
	} else
		return true;
}

function validBgiName(e){
	if(e.value == ""){
		e.errorText = "商品名称不能为空！";
        e.isValid = false;
	}
}

function validBgiGroup(e){
	if(e.value == "" || e.value == "-1"){
		e.errorText = "请选择商品分类！";
        e.isValid = false;
	}
}

function validBgiBrand(e){
	if(e.value == "" || e.value == "-1"){
		e.errorText = "请选择商品品牌！";
        e.isValid = false;
	}
}

function validBgiPrice(e){
	if(!XMAppUtils.isRMB(e.value)){
		e.errorText = "无效的价格！";
        e.isValid = false;
	}
}

function validBgiMarket(e){
	if(!XMAppUtils.isRMB(e.value)){
		e.errorText = "无效的价格！";
        e.isValid = false;
	}
}

function validBgiNumber(e){
	if(!XMAppUtils.isRMB(e.value)){
		e.errorText = "无效的输入！";
        e.isValid = false;
	}
}

function validBgiWarn(e){
	if(!XMAppUtils.isRMB(e.value)){
		e.errorText = "无效的输入！";
        e.isValid = false;
	}
}

function validBgiSupplier(e){
	if(e.value == "" || e.value == "-1"){
		e.errorText = "请选择商品供货商！";
        e.isValid = false;
	}
}

function validBgiOn(e) {
	if (mini.get("bgiOn_gft").getText() == ""
			|| mini.get("bgiOn_gft").getText() == "null") {
		e.errorText = "上架时间不能为空！";
		e.isValid = false;
	} else if (mini.get("bgiOff_gft").getText() != ""
			&& mini.get("bgiOff_gft").getText() != "null"
			&& !compareDate(mini.get("bgiOn_gft").getText(), mini
							.get("bgiOff_gft").getText())) {
		e.errorText = "请正确输入上架时间！";
		e.isValid = false;
	}
}

function validBgiOff(e) {
	if (mini.get("bgiOff_gft").getText() == ""
			|| mini.get("bgiOff_gft").getText() == "null") {
		e.errorText = "下架时间不能为空！";
		e.isValid = false;
	} else if (mini.get("bgiOn_gft").getText() != ""
			&& mini.get("bgiOn_gft").getText() != "null"
			&& !compareDate(mini.get("bgiOn_gft").getText(), mini
							.get("bgiOff_gft").getText())) {
		e.errorText = "请正确输入下架时间！";
		e.isValid = false;
	}
}

function validBgiOrder(e){
	if(e.value == "" || e.value == "null"){
		e.errorText = "商品排序不能为空！";
        e.isValid = false;
	}
}

//function validBgiOtime(e){
//	if(mini.get("bgiOtime_gft").getText() == "" 
//		|| mini.get("bgiOtime_gft").getText() == "null"){
//		e.errorText = "排序日期不能为空！";
//        e.isValid = false;
//	}
//}

function validBtaGtype(e){ 
	if(e.value == "" || e.value == "-1"){
		e.errorText = "请选择商品类型！";
        e.isValid = false;
	}
}

